Java Workshop

 

Huw Collingbourne shows how to create a user interface using the visual design tools of SuperCede 2.0. The end result is a simple adventure game similar to the one below (note, this will only be visible if you are currently using a Java 1.1 Web Browser such as Microsoft Internet Explorer 4.0) :

 

To try it out, click the ‘Look’ button to show a description of the current location and the objects it contains. To take an object, click over the text field and enter the name of an object, such as ‘bubblegum’ then click the ‘Take’ button. Click ‘Look’ again to check that the object has been added to your inventory. Click the four compass direction buttons to move from room to room.

The game shown above has been compiled as a Java applet so that it can be embedded into a HTML Web page such as this one. However, unlike a standalone Java application, an applet cannot contain a drop-down menu system, nor (for security reasons) can it save or load data from disk. Obviously, it would be more useful if the game allowed you to save games. For that reason, the code in Java Workshop implements it as a standalone application.

But how, you may wonder, was I able to convert my standalone application into an applet? Well, first of all I had to comment out all the code defining the menus. Then I double-clicked the Main form in the visual designer in order to pop up the Properties Inspector. On the Form page I changed the type from Application to Applet:

Next I had to ‘extract’ the class files by selecting the Component, Extract Setup menu item. In the dialog box, I checked off the ‘Create jar file’ option and pressed the Extract button:

To make the applet run inside a Web page I also had to copy the support file, sc20form.jar, from SuperCede’s \JARS directory into the directory containing my class files. For more information on deploying applets, search the Help system for: ‘applets, deploying (overview)’.